package com.service.impl;

import com.mapper.RolePowerMapper;
import com.service.RolePowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RolePowerServiceImpl implements RolePowerService {
    @Autowired
    private RolePowerMapper rolePowerMapper;
    @Override
    public int updateRolePower(long roleId, String[] powers) {
        rolePowerMapper.deleteRolePowerByRoleId(roleId);
        for (int i=0;i<powers.length;i++){
            rolePowerMapper.insertRolePower(roleId,powers[i]);
        }
        return 1;
    }
}
